import request from '@/utils/request'
//---------- 骑手 -----------//

export function findRiderList(data) {
    return request({
        url: '/users/rider/list',
        method: 'get',
        params: data,
    })
}
export function findAllRiderList(key) {
    return request({
        url: '/users/rider/all',
        method: 'get',
        params: {key:key},
    })
}
export function getRider(id) {
    return request({
        url: '/users/rider/detail/'+id,
        method: 'get'
    })
}
export function saveRider(data) {
    if(data.id == null){
        return request({
            url: '/users/rider',
            method: 'post',
            data: data
        })
    }else{
        return request({
            url: '/users/rider/'+data.id,
            method: 'put',
            data: data
        })
    }

}
export function deleteRider(id) {
    return request({
        url: '/users/rider/'+id,
        method: 'delete'
    })
}
//---------- 员工 -----------//
export function findList(data) {
    return request({
        url: '/users',
        method: 'get',
        params: data,
    })
}

export function save(data) {
    if(data.id == null){
        return request({
            url: '/users',
            method: 'post',
            data: data,
        })
    }else{
        return request({
            url: '/users/'+data.id,
            method: 'put',
            data: data,
        })
    }

}
export function findDetail(id) {
    return request({
        url: '/users/'+id,
        method: 'get',
    })
}
export function resetPassword(id) {
    return request({
        url: '/users/resetPassword/'+id,
        method: 'put',
    })
}
export function deleted(id) {
    return request({
        url: '/users/'+id,
        method: 'delete',
    })
}

export function generateQrCode(id) {
    return request({
        url: '/users/generateQrCode/'+id,
        method: 'post'
    })
}
export function relieveQrCode(id) {
    return request({
        url: '/users/relieveQrCode/'+id,
        method: 'post'
    })
}
export function checkWxBind(id) {
    return request({
        url: '/users/checkBind/'+id,
        method: 'get'
    })
}
